<%@page pageEncoding="utf-8" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>
        车辆列表
    </title>
    <style>
        #c{
            display: inline-block;
            margin-left: 30px;
        }
    </style>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/main.css" media="all">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.css">
</head>
<body>
<div class="x-nav">
            <span class="layui-breadcrumb">
              <a><cite>首页</cite></a>
              <a><cite>业主信息管理</cite></a>
              <a><cite>车辆管理</cite></a>
            </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"  href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <xblock>
        <button class="layui-btn" onclick="add('车辆添加','${pageContext.request.contextPath}/car/addUi','1000','600')">
            <i class="layui-icon">&#xe608;</i>添加
        </button>
        <form id="c" action="${pageContext.request.contextPath}/car/select" method="post" style="width:800px">
            <div class="layui-input-inline">
                <input type="text" name="name"  placeholder="户主名称" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline" style="width:80px">
                <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
            </div>
        </form>
        <span class="x-right" style="line-height:40px">共有数据：<span class="layui-badge">${cars.size()}</span> 条</span>
    </xblock>
    <table class="layui-table">
        <thead>
        <tr>
            <th>ID</th>
            <th>车辆照片</th>
            <th>所属成员</th>
            <th>车辆颜色</th>
            <th>车牌号</th>
            <th>备注</th>
            <th>创建时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody id="x-img">
        <c:forEach items="${pageInfo.list}" var="car" varStatus="states">
            <tr>
                <td>${states.index + 1}</td>
                <td>
                    <img src="${pageContext.request.contextPath}/images/${car.picture}" width="40px">
                </td>
                <td>${car.pname}</td>
                <td>${car.number}</td>
                <td>${car.color}</td>
                <td>${car.remark}</td>
                <td>
                    <fmt:formatDate value="${car.createTime}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate>
                </td>
                <td class="td-manage">
                    <a title="编辑" href="javascript:;" onclick="edit('编辑','${pageContext.request.contextPath}/car/editUi','${car.id}','1000','600')"
                       class="ml-5" style="text-decoration:none">
                        <i class="layui-icon">&#xe642;</i>
                    </a>
                    <a title="删除" href="${pageContext.request.contextPath}/car/delete?id=${car.id}"
                       style="text-decoration:none">
                        <i class="layui-icon">&#xe640;</i>
                    </a>
                </td>
            </tr>
        </c:forEach>

        </tbody>
    </table>

    <div id="page">
        <ul class="pagination">

            <li <c:if test="${pageInfo.pageNum == 1}">class="disabled"</c:if>>
                <a href="${pageContext.request.contextPath}/car/listUi?pageNum=1">&laquo;</a>
            </li>

            <li>
                <c:if test="${pageInfo.pageNum == 1}">
                    <a>&lt;</a>
                </c:if>
                <c:if test="${pageInfo.pageNum != 1}">
                <a href="${pageContext.request.contextPath}/car/listUi?pageNum=${pageInfo.pageNum-1}">&lt;</a>
                </c:if>
            </li>

            <c:forEach begin="1" end="${pageInfo.pages}" var="index">
                <li <c:if test="${index == pageInfo.pageNum}">class="active"</c:if>>
                    <a href="${pageContext.request.contextPath}/car/listUi?pageNum=${index}">${index}</a>
                </li>
            </c:forEach>

            <li>
                <c:if test="${pageInfo.pageNum == pageInfo.pages}">
                    <a>&gt;</a>
                </c:if>
                <c:if test="${pageInfo.pageNum != pageInfo.pages}">
                <a href="${pageContext.request.contextPath}/car/listUi?pageNum=${pageInfo.pageNum+1}">&gt;</a>
                </c:if>
            </li>

            <li <c:if test="${pageInfo.pageNum == pageInfo.pages}">class="disabled"</c:if>>
                <a href="${pageContext.request.contextPath}/car/listUi?pageNum=${pageInfo.pages}">&raquo;</a>
            </li>


        </ul>

    </div>
</div>
<script src="${pageContext.request.contextPath}/lib/layui/layui.js" charset="utf-8"></script>
<script src="${pageContext.request.contextPath}/js/x-layui.js" charset="utf-8"></script>
<script>
    layui.use(['laydate','element','laypage','layer'], function(){
        $ = layui.jquery;//jquery
        laydate = layui.laydate;//日期插件
        lement = layui.element();//面包导航
        laypage = layui.laypage;//分页
        layer = layui.layer;//弹出层
        layer.ready(function(){ //为了layer.ext.js加载完毕再执行
            layer.photos({
                photos: '#x-img'
                //,shift: 5 //0-6的选择，指定弹出图片动画类型，默认随机
            });
        });

    });

    function question_show (argument) {
        layer.msg('可以跳到前台具体问题页面',{icon:1,time:1000});
    }
    /*添加*/
    function add(title,url,w,h){
        x_admin_show(title,url,w,h);
    }
    //编辑
    function edit (title,url,id,w,h) {
        url = url+"?id="+id;
        x_admin_show(title,url,w,h);
    }

    /*删除*/
    function veh_del(obj,id){

    }
</script>

</body>
</html>